﻿namespace NTLib.Pipe.Targets
{
    using Core.Pool;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    /// <summary>
    /// Define the basic information to found a target
    /// </summary>
    public abstract class TargetLocation : PoolItem, ITargetLocation
    {
        #region Fields

        private Guid _id;

        #endregion

        #region Ctor

        /// <summary>
        /// Initializes a new instance of the <see cref="TargetLocation"/> class.
        /// </summary>
        public TargetLocation()
        {
            this._id = Guid.NewGuid();
        }

        #endregion

        #region Properties

        /// <summary>
        /// Gets the identifier.
        /// </summary>
        /// <value>
        /// The identifier.
        /// </value>
        public Guid Id { get { return this._id; } }

        /// <summary>
        /// Gets the readeable name of the entity.
        /// </summary>
        /// <value>
        /// the readeable name of the entity.
        /// </value>
        public string ReadeableName { get; set; }

        #endregion

        #region Methods

        /// <summary>
        /// Called when the pool item is reset.
        /// Everything MUST be initialized on this method.
        /// </summary>
        protected override void OnReset()
        {
            this._id = Guid.NewGuid();
            this.ReadeableName = null;
        }

        /// <summary>
        /// Called when the pool item is reset.
        /// Everything MUST be initialized on this method.
        /// </summary>
        protected abstract void OnDataReset();

        #endregion
    }
}
